MAPS
Photo by Boudewijn Huysmans on Unsplash
This is not an invasion of Cambodia….
— US President Nixon, Speech on Cambodia, April 30, 1970
df <- read.csv("archetypes/bombing-cambodia/cambodia-sites-targeted-in-us-bombing-1965-1975.csv", header = TRUE)
head( df, n = 10 )
df_simplified <- df %>% mutate(LATR = round(LAT, digits = 3), LONR = round(LON, digits = 2)) %>%
group_by(LATR, LONR) %>%
summarise(LOAD_LBS = sum(LOAD_LBS), COUNT = n())
head( df_simplified, n = 10 )
# Load map sources
# ++++++++++++++++++++
# using the same map sources up to adm2 which contains info of area of district in each region in Uganda
adm0 <- st_read("archetypes/bombing-cambodia/maps/khm-admbnda-adm0-gov.geojson")
adm1 <- st_read("archetypes/bombing-cambodia/maps/khm-admbnda-adm1-gov.geojson")
adm2 <- st_read("archetypes/bombing-cambodia/maps/khm-admbnda-adm2-gov.geojson")
adm3 <- st_read("archetypes/bombing-cambodia/maps/khm-admbnda-adm3-gov.geojson")
soil_fertility <- st_read("archetypes/bombing-cambodia/maps/soil-fertility.geojson")
rivers <- st_read("archetypes/bombing-cambodia/maps/khm_rivl_gov.geojson")
lakes <- st_read("archetypes/bombing-cambodia/maps/khm-lakea-riva-gov.geojson")
# view to read properties
# head(as.data.frame(adm0))
# head(as.data.frame(adm1))
# head(as.data.frame(adm2))
# head(as.data.frame(adm3))
# head(as.data.frame(soil_fertility))
# head(as.data.frame(rivers))
# head(as.data.frame(lakes))
# used for color scale
# unique(soil_fertility$type_en)
theme_opts <- theme(
text = element_text(family = "inconsolata"),
plot.title = element_text(color = "black", size = 18, face = "bold"),
plot.background = element_blank(),
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
panel.border = element_blank(),
legend.position = "none",
legend.title = element_blank()
)
transparent_fill <- rgb(0, 0, 0, max = 255, alpha = 0, names = "transparent")
v1 <- ggplot() +
geom_sf(data = adm0, color="#333333", fill = transparent_fill, size=2.0) +
# geom_sf(data = adm1, color="#333333", fill = transparent_fill, size=1.5) +
geom_sf(data = adm2, color="#333333", fill = transparent_fill, size=1.0) +
# geom_sf(data = adm3, color="#333333", fill = transparent_fill, size=0.25) +
geom_sf(data = lakes, color="#abc8cb", fill = "#abc8cb", size=0.25) +
# geom_point(data = df, aes(x = LON, y = LAT), size = 2, color="red" ) +
geom_point(data = df_simplified, aes(x = LONR, y = LATR, size = LOAD_LBS, alpha = COUNT), color="red" ) +
scale_size_continuous(range = c(2,5)) +
scale_alpha_continuous(range = c(0.2, 0.8)) +
scale_x_continuous() +
scale_y_continuous() +
coord_sf() +
theme_bw() +
labs(x = NULL, # Longitude
y = NULL, # Latitude
title = NULL,
subtitle = NULL) +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 13,
options = list(opts_sizing(rescale = TRUE, width = 0.5)))